﻿$(document).ready(function() {


    onLoadRolePage();
    loadGrid();
});

function onLoadRolePage() {
    $('#roleForm').submit(function (e) {
        onSubmitRole();
        return false;
    });

   
}

function onSubmitRole() {
    alert('');
    jQuery.ajax({
        type: 'post',
        url: '/Role/Create?leon=test',
        data: jQuery("#roleForm").serialize(),
       
        dataType: 'json'
    });
    
    }


function executePostCondition(result) {

}

function loadGrid() {

    $("#flex1").flexigrid({
	        url: '/Role/List',
	        dataType: 'json',
	        colModel: [
				{ display: 'OID', name: 'OID', width: 40, sortable: true, align: 'left' },
				{ display: 'Name', name: 'Name', width: 100, sortable: true, align: 'left' },
				{ display: 'Description', name: 'Description', width: 100, sortable: true, align: 'left' }
				],

	        sortname: 'OID',
	        sortorder: 'asc',
	        usepager: true,
	        title: 'Customers',
	        useRp: true,
	        rp: 15,
	        showTableToggleBtn: true,
	        width: 1040,
	        height: 380
	    });
}

function resetForm() {
clearForm($("#roleForm"));
$('#btnSave').attr('value', 'Create');
$('#btnCancle').focus();
}



